# -*- coding: UTF-8 -*-
import cgi
import os
from google.appengine.ext import db
from google.appengine.ext.webapp import template
from google.appengine.api import users
from google.appengine.ext import webapp
from google.appengine.ext.webapp.util import run_wsgi_app
from google.appengine.api import images
from google.appengine.ext.webapp.util import login_required
from modules.ds.dsBase import *
from modules.ds.dsCustom import *

class Image (webapp.RequestHandler):
  def get(self):
      curr_user = self.request.get("id")
      if curr_user == 0:
          self.response.out.write("No image")
      else:
          if curr_user.photo:
              self.response.headers['Content-Type'] = "image/jpg"
              self.response.out.write(curr_user.photo)
          else:
              self.response.out.write("No image")

application = webapp.WSGIApplication([('/image', Image)],
                                      debug=True)

def main():
  run_wsgi_app(application)
if __name__ == "__main__":
      main()